+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NUMBER BOARD PLUS for Lambda 8300     |
+   by Jim Waterman,  18-19 December 2023   +
|              for CSSCGC 2024              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Heavily based on  "Number Board" for ZX80 |
+    by Robert Bumstead, March/April 1983   +
|        issue of  Sinclair Programs        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Waffle
======

Robert Bumstead must be something of a hero. Never mind having to put up with that surname during his schooldays - I'll bet they must have just *flown* by - he still had a ZX80 (and no RAM pack!) some time in the later months of 1982, maybe even early 1983, and sent a listing to Sinclair Programs for the March/April 1983 issue for The Great Sir Clive's most primitive first attempt at a computer (barring the MK14, which was more in The Uncanny Valley between a computer and a calculator).

The game is very simple - here are some numbers on the screen, which will take a few seconds to draw off-screen, get from the top left to the bottom right, racking up as low a total score as possible. Control is by INPUT - the ZX80 had no INKEY$ and machine code was horrifically impractical (ask me how I know!) - and each number you run over adds that amount to your score. On a ZX80, this was about as "good" as games could get, unless you're a genius like Paul Farrow.

Having recently greatly enhanced a Spectrum listing for the 2023 edition of WOOT! Tape Magazine, in which I dismissed the idea of submitting a rehashed Sinclair Programs listing for the CSSCGC, I found out I'd done exactly that two years previously... "Grumphers", originally by John Litherland for the Spectrum, and published in the July 1983 issue, was given a "demake" for the Lambda 8300, a.k.a. "a ZX81½ with a side order of sweet & sour sauce". This was mainly because the in-built gaming graphics of the Lambda 8300 looked like they'd be fine candidates to use in a game such as "Grumphers".

So, after getting the sudden idea to remake "Number Board" for the ZX81, instead I turned my attention to its Strange Cousin From The East...


Emulation
=========

For those not up to speed with Lambda 8300 emulation, your best choice is EightyOne. NO$ZX also has it available... but it's a pain to use and the author only communicates with those who are as fluent in programming as he is.

Select Options -> Hardware (or press F6).
Under "Others", select Lambda 8300. "RAM Pack: 2k" will be automatically selected - so select "16k" (this game will need it), and "Colour: Lambda" to avoid seeing everything in white-on-black.
Type LOAD "" and ENTER (yes, ENTER, not NEWLINE) as you would do for a ZX81.
The Lambda doesn't use the ZX81's token-entry system, so you'll have to type L-O-A-D in full, yourself.

Better still, type NOBEEP and ENTER before you do anything else.


Of happenings
=============

As with the original ZX80 "Number Board", you must travel from top left to bottom right, with each number adding to your score. Numbers range from 1 to 8 (as a side effect of the machine code used to generate the screen; if I'd done it in BASIC with number 1-9 it takes 49 seconds to generate in FAST mode with a blank screen and FIVE MINUTES in SLOW mode...!)

But! In addition to the extra colour (which is optional - the game will work without the Lambda's colour module, but the graphics are much less distinct), the game cannot be finished without picking up the "Grumphers" along the way. They must be picked up in a specific order - first the green ghost, then the yellow four-legged spider, and then the red bat. (All of which will be white without the colour module attached.)

Pressing "H" at the title screen for a harder game will drop the "Grumphers" into less convenient sections of the screen. It's probably more "annoying" than "hard", but isn't this supposed to be the CSSCGC?

Your score will be the total amount of the numbers picked up from start to finish, multiplied by the time taken (in approximate-seconds, i.e. FRAMES divided by 60, because this is a 60 Hz machine).

A "lo-score" (not a "hi-score" here!) is displayed and held in nine bytes of a REM statement - so it won't be erased by typing RUN. To reset it to default, break into the listing and GOTO 9800.

Because I'm an utter sadist I have used the cursor keys as the only control option. Fortunately, the Lambda's cursor keys aren't quite as idiotically laid out as the Sinclair machines - up and down and next to each other but are operated by the same fingers as Q and A in standard QAOP controls. You will need:

C = up      V = down    B = left    N = right

Deal with it.

Deal also with the way the screen rolls any time I've used the Lambda's MUSIC command (along with TEMPO). It's unique to this machine, and you didn't think I was going to miss this chance, did you? It's also a neat tribute to the ZX80 and the way its screen would distort horribly with every key press. How far we came in just a short time...


Development log
===============

18 December 2023:
- Typed in Number Board for the ZX80, assessed each line (there aren't many of them) to see how it works. As it's a 1K ZX80 game, it is very, very simple. It reads from and writes to the display file directly, and the ZX81 uses the same address (as does the Lambda).
- alpha1: Drew the new very-much-graphically-enhanced screen. It takes 49 seconds to generate in FAST mode and... *5m10s* to do so in SLOW mode! I think this needs machine code...
- alpha2: Added a crude machine code loader at 9900-9970. Put in Patrik Rak's random number generator (that can be called from MC) and a routine to drop random numbers 1-8 onto the screen.
Except, there's a problem. The RNG un-randomises itself and all that is output is a load of 1s...!

19 December 2023:
- alpha3: There was an ADD A,A missing in my hand-assembly! D'oh. The machine code is now working and the number board generates as it should - although there's still some trouble trying to get the colours to work properly.
Also improved the board border (now says "number board+").
- alpha4: Added score and "lo-score" to the setup, and a way to reset the "lo-score" (though not from within the game). Also, rehashed the order slightly so that the USR call to generate the board is separate from the game area border, and the GRUMPHERS (i.e. the shift-1-to-3 graphics) are generated in three segments of the screen depending on Easy game (H=0) or Hard game (H=1).
- alpha5: Added more machine code to make a SCREEN$ facility (which the original ZX80 Number Board game uses). NOTE that the routine I wrote for "Grumphers" in 2022 worked by sheer blind luck! 16396 IS NOT the address of the display file on the Lambda! It's listed in the (Chinese...) system variable list as "PROGRAM" and does give the start of the program if the computer is reset. But it will change and start giving values in the display file. Either way, as the display file has a fixed start at 16509 (for the 16K version at least), this does simplify the machine code slightly, and I'm better at it now than I was then. Note: 16510 is the address of (0,0) and each line is 33 bytes, similar to the ZX81.
- alpha6: Implemented the game loop... only to find there's a mysterious crash and it's nothing whatsoever to do with the machine code. Sometimes the game will stop (and turn BEEP on...?), sometimes it'll crash outright to a black screen.
- alpha7: Solved it. Can't set FRAMES to 0, that was causing the crash. Just need to take two readings from FRAMES (T1 at start and T2 at end), and subtract one from the other. FRAMES *decreases* so T2<T1, unless it rolls back around (which it does at 32768, after which it reverts to 65535, and this takes 9m10s at normal speed). This has been accounted for.
- alpha8: Added the need to capture the Grumphers along the way, and lose the game if they're not collected in the order green-yellow-red.
- alpha9: Added the victory screen and the "another game" inquiry... and used the TEMPO and MUSIC commands for a rudimentary blast of the Final Fantasy victory fanfare.
- alpha10: Added the introductory screen. Which pretty much completes the program, right?
- alpha11: ...not quite. Just needed a bit of music in the "Epic Fail" section, and a couple of minor corrections.

And that's a third Lambda 8300 entry for the CSSCGC! All courtesy of one author... me!

Kek.
